//
//  ZH_MineOtherTableViewCell.m
//  WisdomStar
//
//  Created by zhangliwen on 2018/10/19.
//  Copyright © 2018年 zhangliwen. All rights reserved.
//

#import "ZH_MineOtherTableViewCell.h"
@interface ZH_MineOtherTableViewCell()
@property (nonatomic,weak)UIView *bgView;
@property (nonatomic,weak)UIImageView *leftImage;
@property (nonatomic,weak)UILabel *leftLabel;
@property (nonatomic,weak)UIImageView *rightImage;
@property (nonatomic,weak)UILabel *rightLabel;
@property (nonatomic,weak)UIView *lineView;
@end
@implementation ZH_MineOtherTableViewCell

///创建
+(instancetype)cellWithTableView:(UITableView*)tableView
{
    static NSString *ID = @"ZH_MineOtherTableViewCell";
    ZH_MineOtherTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if(cell == nil){
        cell = [[ZH_MineOtherTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
    }
    return cell;
}
///初始化
-(void)initDefault
{
    [self unShowClickEffect];
    //    self.bottomShortLineImage.hidden = NO;
}
- (void)loadSubviewConstraints{
    [self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).offset(FITSCALE(0));
        make.left.equalTo(self.contentView).offset(FITSCALE(12));
        make.right.equalTo(self.contentView).offset(FITSCALE(-12));
        make.height.mas_equalTo(FITSCALE(50));
        make.bottom.equalTo(self.contentView);
    }];
    [self.leftImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView);
        make.left.equalTo(self.bgView).offset(FITSCALE(10));
    }];
    [self.leftLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView);
        make.left.equalTo(self.leftImage.mas_right).offset(FITSCALE(12));
    }];
    [self.rightImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView);
        make.right.equalTo(self.bgView).offset(FITSCALE(-10));
    }];
    [self.rightLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView);
        make.right.equalTo(self.rightImage.mas_left).offset(FITSCALE(-10));
    }];
    [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.leftLabel);
        make.bottom.equalTo(self.contentView).offset(FITSCALE(0));
        make.height.mas_equalTo(FITSCALE(1));
        make.right.equalTo(self.bgView);
    }];
}
- (void)setLeftImageString:(NSString *)leftImageString{
    self.leftImage.image = [UIImage imageNamed:leftImageString];
}
- (void)setLeftString:(NSString *)leftString{
    self.leftLabel.text = leftString;
}
- (void)isHidden:(BOOL)isbool{
    self.rightLabel.hidden = isbool;
}
#pragma mark - getter,setter
- (UIView *)bgView{
    if (!_bgView) {
        UIView *view = [UIView createViewWithBackgroundColor:kFontColorWhite];
        [self.contentView addSubview:_bgView = view];
    }
    return _bgView;
}
- (UIImageView *)leftImage{
    if (!_leftImage) {
        UIImageView *image = [UIImageView createImageViewWithName:@""];
        [self.contentView addSubview:_leftImage = image];
    }
    return _leftImage;
}
- (UILabel *)leftLabel{
    if (!_leftLabel) {
        UILabel *label = [UILabel createLabelWithText:@"" font:kFontSize_30];
        label.font = [UIFont boldSystemFontOfSize:15];
        [self.contentView addSubview:_leftLabel = label];
    }
    return _leftLabel;
}
- (UIImageView *)rightImage{
    if (!_rightImage) {
        UIImageView *image = [UIImageView createImageViewWithName:@"icon_mygetmore1"];
        [self.contentView addSubview:_rightImage = image];
    }
    return _rightImage;
}
- (UILabel *)rightLabel{
    if (!_rightLabel) {
        UILabel *label = [UILabel createLabelWithText:@"021-88886666" font:kFontSize_26];
        label.textAlignment = NSTextAlignmentRight;
        [self.contentView addSubview:_rightLabel = label];
    }
    return _rightLabel;
}
- (UIView *)lineView{
    if (!_lineView) {
        UIView *view = [UIView createViewWithBackgroundColor:[UIColor colorWithHexString:@"#DFDFDF"]];
        [self.contentView addSubview:_lineView = view];
    }
    return _lineView;
}
@end
